﻿using System;
using System.Data;
using System.Xml;

namespace Utilities
{
    public class XmlHelper
    {
        /// <summary>
        /// 根据Xml获得dataset
        /// </summary>
        /// <param name="FilePath">路径</param>
        /// <returns>DataSet</returns>
        public static DataSet getXmlDataSet(string FilePath)
        {
            DataSet ds = new DataSet();
            XmlDocument xd = new XmlDocument();

            try
            {
                xd.Load(FilePath);
                XmlNodeReader reader = new XmlNodeReader(xd);
                ds.ReadXml(reader);
                reader.Close();
                xd = null;
            }
            catch
            {
                ds = null;
            }
            finally
            {
                xd = null;
            }
            return ds;
        }
        /// <summary>
        /// 获得系统详情
        /// </summary>
        /// <param name="FilePath">文件路径</param>
        /// <returns></returns>
        public static DataSet GetSystemType(string FilePath)
        {
            return getXmlDataSet(FilePath);
        }
    }
}
